package com.ling.luo.config.ali;

import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

@Component
public class AlipayConfig {

    // http://www.first.mypay.com/first-alipay
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101700710523";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCS/p77rq/sHr9zN08ujZRK/mN9trgGdOC+BPKz++NqjWGkafso2WofRupACpXyZAkPV28dNpZ/sVvZUlQPxVciaXex89lkF3/ex0j/CfMsDRqEuGICt3uqu4qpBOS1sfo4NPpRIfMuKRCV/cEh3Mpwt8Z7ZfG2WzIBkupTIDNzqaOaAxpURwAonc7+NyeXLgwdmgfD3OdLxqOveH+jNhf5R4tf6lAEST0zMQBxTSJVtbTsTkbTDRq39wBy1JW2qbSFR5tTsZfv7nspDnTYTw031Cl2NLydyD01b5UPGojXjnoeBNZ6d7rHswNPnvgJVXlumACD1SoxE2UhbywIXyK/AgMBAAECggEAMhkVljGzQ4Y3Oc1f7z3RjL2mqvHbRlgPQLPvA+iVWXtWC/MS5pky0fYZYDo7YKE3dUMXW51/LYYFB8xHWhin2dKYOM4jCTn5GrRQ7Js3hYvxvcoZnVNrkoTYfUJtsH84CHAF4CDyAIl+XaBecmwNkt0PiH72InByWpb3xdzzrDder5NzenwN6kDcXIks8QJuxt8CNixZ7yN0pFsMXG8NsgIfi9T6P1vwN34a1+KOwv2IuW216feqzEkXzqdAkV73KKWcL1d//bi4XIFBWNqJb1RSFzymPQVjix2RzAV3ufruFDFUdzSap9+AVyBeDVBZVBZLFP9RWnp4u0LL8cBEAQKBgQDljJRtIvVegmI48u+rkyi1uqJdz/qyTjAEkJNvQDCkZ7PGf1Voze6rRiv2XPV/62yQk14bW5jRaVODw1FSMvuJpMhariVXJ5zHn4HsRcz6yk0tMnIhQpuRVopiford/XV9pq19dG7y9nrkictYZpJVuzdKZQquKuq1qAHIGLAZ+QKBgQCj7sh/je6CZvr1zH/bcMXj2aPwINQV3hOk5jvLiHvMrgDc7HMXZE/BYdpI6Rgbv/eWJbN6anY/ud847d+DamEMtxcJZGfEktr76ba8WnDO1Jz5kJx+FnTqw739RjVmo/hAgre0+6k3uFiq+7uKktORT85iAJjmFuT7JR+N4N+QdwKBgQColUUQneL8ZN9EGc7BAFOem5HROgRQ3TFQuOk+hDL1GyAhwLR2Qv9slB2HUqAOMVVLHJ+5kdy6txLZqyFXMBAh934ZctoDlxkCVnfxkRXIfbiOYAUHvkZIR/lb+rl77UBTZoz1nQQ6taBtpXFM3A/OnK8vmONuJCC6BshALzlt6QKBgQCefgQ23oBUbz//WSHchWGt8wO+695g7f7MFRSGqYQX1btb3PdBDGjXrMWgbEw0uBqlffnSRw/geNJKdiD9K2J9Kp8JI5v3v4wctk9IN6CNN5404w2KEigjue/76V9DxxADPt5iClYGWyLO3ObrCR2nhiMhOTaablQgRDoHr/w17QKBgHNwzUj7BEQbBVRB/+bu57hjK2pQsavwwGvu4He6I7+bj0myEhxVVQ5SvHw/CjcOTWzou614tsTqsw84pVVIt8BDPriFdeMGHt9uuEIMHOIk+OZQukMcejessA/hZ8ErWj695igHSYEwsIgGTICOVq3vcZVR8YRDMwmMeCuIFde5";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5PHK++DFNTun7YE4/3WIln3XH6DmaldriTvEIbzvj622810ta51buOnUvPcTAFJN7JifliQ0saLtCe1SHV/+6ONy95rViCkdDIhDmoD1S8OvpWdcyg5QY2McqVkhAPG4l6izjcjXOveOwp6fLKCIK6GA7IBIudcpZQJt1qu3/rVJ/y/S99R0Uh9zjFRsR8kMiRu5KEIiNm6N0EAOG9VTHnygHvLPodT9FEjvrhlfGi4KOs/j58520siMjSSR8nHu9pVjd9ZHgqDl3lrS8qY4Ht0uWHk8gKcRqSzs69C/nC2pOZ+6AuXMaY0RoxDvpXIFwTyLHyEp0f70viA5Z5NZZQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://lingluo.free.idcfengye.com/alipay/pay/alipayNotify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://lingluo.free.idcfengye.com/alipay/demo";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }


}

